Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Text
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls



<ToolboxData("<{0}:SixthSample runat=server></{0}:SixthSample>")> _
Public Class SixthSample
    Inherits WebControl
    Dim strText As String = "Hello, World"

    Protected Overrides Sub CreateChildControls()
        Dim txt As System.Web.UI.WebControls.TextBox
        Dim btn As System.Web.UI.WebControls.Button
        Dim stl As System.Web.UI.WebControls.Style

        stl = Me.ControlStyle()
        stl.BorderStyle = System.Web.UI.WebControls.BorderStyle.Inset

        txt = New System.Web.UI.WebControls.TextBox
        txt.ID = "Text1"
        txt.ForeColor = Drawing.Color.Red
        txt.MergeStyle(stl)
        Me.Controls.Add(txt)

        btn = New System.Web.UI.WebControls.Button
        btn.ForeColor = Drawing.Color.Green
        btn.ID = "Button1"
        btn.MergeStyle(stl)
        Me.Controls.Add(btn)

        Dim stl2 As System.Web.UI.WebControls.Style
        Dim txt2 As New System.Web.UI.WebControls.TextBox

        stl2 = New System.Web.UI.WebControls.Style
        stl2 = txt.ControlStyle
        txt2.MergeStyle(stl2)
        Me.Controls.Add(txt2)

        Dim txt3 As System.Web.UI.WebControls.TextBox
        Dim btn3 As System.Web.UI.WebControls.Button
        Dim stl3 As System.Web.UI.WebControls.Style

        stl3 = Me.ControlStyle()

        txt3 = New System.Web.UI.WebControls.TextBox
        txt3.ID = "Text1"
        txt3.MergeStyle(stl3)
        Me.Controls.Add(txt3)

        btn3 = New System.Web.UI.WebControls.Button
        btn3.ID = "Button1"
        btn3.MergeStyle(stl3)
        Me.Controls.Add(btn3)

    End Sub

    Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
        'Comment out this routine to see the results of the CreateChildControls method
        Dim stl As System.Web.UI.WebControls.Style

        stl = Me.ControlStyle
        stl.ForeColor = Drawing.Color.Red
        MyBase.RenderBeginTag(writer)
        writer.Write(strText)
        MyBase.RenderEndTag(writer)

    End Sub

End Class
